package app.com.business.dao.impl;

import java.util.List;

import org.springframework.orm.hibernate3.HibernateObjectRetrievalFailureException;

import app.com.business.bo.Prof;
import app.com.business.dao.ProfDao;
import app.com.business.exceptions.MaterielException;

import com.groupeA.dao.impl.GenericDaoImpl;

public class ProfDaoImpl extends GenericDaoImpl<Prof, Long> implements ProfDao{

	public ProfDaoImpl() {
		super(Prof.class);
	}

	public Prof getProfByCodeProf(String profSelectionnee) throws MaterielException{
		try {
			List profs =  getHibernateTemplate().find("from Prof where codeProf = ?", profSelectionnee);
			if(profs.size() == 0 | profs == null | profs.get(0) == null){
				throw new MaterielException();
			}
			return (Prof)profs.get(0) ;
			}catch(HibernateObjectRetrievalFailureException ex)
			{
				throw new MaterielException();
			}
	}
	
	

}
